<template>
  <div>
    <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px">
      <el-form-item label="药品名称" prop="drugName">
        <el-input v-model="formData.drugName" placeholder="请输入药品名称" clearable :style="{width: '100%'}">
        </el-input>
      </el-form-item>
      <el-form-item label="审核编码" prop="code">
        <el-input v-model="formData.code" placeholder="请输入审核编码" clearable :style="{width: '100%'}">
        </el-input>
      </el-form-item>
      <el-form-item label="住院号" prop="admissionId">
        <el-input v-model="formData.admissionId" placeholder="请输入住院号" clearable :style="{width: '100%'}">
        </el-input>
      </el-form-item>
      <el-form-item label="电子病历" prop="complain">
        <el-input v-model="formData.complain" type="textarea" placeholder="请输入电子病历"
          :autosize="{minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
      </el-form-item>
      <el-form-item size="large">
        <el-button type="primary" @click="submitForm">提交</el-button>
        <el-button @click="resetForm">重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { addMedical } from "@/api/system/verify";
export default {
  components: {},
  props: [],
  data() {
    return {
      formData: {
        drugName: undefined,
        code: undefined,
        admissionId: undefined,
        complain: undefined,
      },
      rules: {
        drugName: [{
          required: true,
          message: '请输入药品名称',
          trigger: 'blur'
        }],
        code: [{
          required: true,
          message: '请输入审核编码',
          trigger: 'blur'
        }],
        admissionId: [{
          required: true,
          message: '请输入住院号',
          trigger: 'blur'
        }],
        complain: [{
          required: true,
          message: '请输入电子病历',
          trigger: 'blur'
        }],
      },
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    submitForm() {
      this.$refs['elForm'].validate(valid => {
        if (!valid) return
        // TODO 提交表单
        addMedical(this.formData).then(response => {
          if (response.code === 200) {
            this.verifyResult = response.data;
            this.msgSuccess("录入成功!");
          }
        });
        
      })
    },
    resetForm() {
      this.$refs['elForm'].resetFields()
    },
  }
}

</script>
<style>
</style>
